package com.tom.dronedefense;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.Log;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnTouchListener;

public class GameBoardView extends SurfaceView implements 
OnTouchListener, SurfaceHolder.Callback {
	
	/*
	 * Tag used for LogCat
	 */
	private static final String TAG = "GameBoardView";
		
	private SurfaceHolder holder;
	
	public Context context;
	
	public GameBoardView(Context context)  {
		super(context);
		this.context = context;
		setFocusable(true);
		setFocusableInTouchMode(true);
		this.setOnTouchListener(this);
	}
	
	@Override
	public void onSizeChanged(int w, int h, int oldw, int oldh) {
		Log.d(TAG, "width=" + w + " height=" + h);
		holder = getHolder();
		holder.addCallback(this);
		super.onSizeChanged(w, h, oldw, oldh);
	}
		
	public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
		
	}

	@Override
	protected void onDraw(Canvas canvas){
		Log.d(getClass().getSimpleName(),"DRAWWW");
        canvas.drawRect(new Rect(50,50,100,100), new Paint(Color.BLUE));
        Paint p = new Paint();
        p.setColor(Color.BLUE);
        canvas.drawText("Does tis work?", 100, 100, p);
        canvas.drawARGB(1, 1, 1, 0);
	}
	
	public void surfaceCreated(SurfaceHolder holder) {
		}

	public void surfaceDestroyed(SurfaceHolder holder) {
    }

	public SurfaceHolder getSurfaceHolder() {
		return holder;
	}

	public boolean onTouch(View v, MotionEvent event) {
		// TODO Auto-generated method stub
		return false;
	}


}
